<template>
	<view>
		<view class="bgImg">
		    <view class="textContent">
				<view class="conTitle">客服电话</view>
				<view class="conPhone">{{textX?textX:''}}</view>
				<view class="conTip">请拨打电话联系客服</view>
		    </view>
		</view>
		<view>
			<button class="btn_appointment arc_button" type="default" @click="call">立即拨打</button>
			
		</view>
	</view>
	
	

</template>

<script>
    import { customerService } from '@/api/my.js'
    export default{
        data(){
            return{
                text:'',
				textX:'',
            }
        },
        onLoad() {
            this.getText()
			
        },
        methods:{
			 call(){
				 uni.makePhoneCall({
				     phoneNumber: this.text //仅为示例
				 });
			 },
            getText(){
                uni.showLoading({
                    title:'加载中'
                })
                // let params = {
                // 	type:'2',
                // 	delFlag :'0'
                // }
                customerService({}).then(res=>{
                    uni.hideLoading()
                    this.text = res.data.configValue;
					if(res.data.configValue){
						let textX = res.data.configValue+''
						let phone = ''
						if(textX && textX.length>=8){
							phone = textX.substring(0,3)+'-'+textX.substring(3,7)+'-'+textX.substring(7)
						}
						this.textX = phone
						console.log(phone)
					}
					
					

                }).catch(err=>{
                    uni.hideLoading()
                    return this.$util.Tips({
                        title: err
                    });
                })
            }
        }
    }
</script>

<style>
    page{
        background-color: #fff;
    }
    .textContent{
        padding: 30rpx 30rpx 80rpx 30rpx;;
		text-align: center;
		color: #fff;
		line-height: 55rpx;
    }
	.bgImg{
		background: url("../../pagesSub/static/images/bg_h_ke@2x.png") no-repeat center;
		/* background: url("http://m.qpic.cn/psc?/V54IYboM4LNcBd3koSry0alVOs2mAPAU/TmEUgtj9EK6.7V8ajmQrEOONuPxWo6hPHpaJWgrzkfYwEvFs5guC110Lk2KjCMBYR*96C5KbGfdLGAWkFzN272Ny6zkDIas80Jo2185n970!/b&bo=7gLfAO4C3wADGTw!&rf=viewer_4") no-repeat center; */
		background-size: 100% auto;
		background-position: top;
		/* background-position: 100% 100%; */
	}
	.conTitle{
		font-size: 34rpx;
	}
	.conPhone{
		font-size: 38rpx;
	}
	.conTip{
		font-size: 32rpx;
	}
	.btn_appointment{
		margin-top: 40rpx;
		background: -webkit-linear-gradient(#77E2A4, #4CCDBC);
		color: #FFFFFF !important;
	}
</style>
